package com.tencreat.domain.mall.vo;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tencreat.common.enums.AfterSaleStatus;
import com.tencreat.common.enums.OrderStatus;
import com.tencreat.common.enums.OrderType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("订单详情返回信息")
public class ResOrderDetailInfoVO {
    public OrderDetail orderDetail;

    public List<GoodsInfo> goodsInfo;

    public UserInfo userInfo;

    public AfterSaleInfo aftersaleInfo;

    private JSONObject logisticsInfo;

    // 退款退货物流信息
    private JSONObject logisticsInfo2;

    private selfmention selfmention;

    @Builder
    @Data
    public static class selfmention {
        private String phone;
        private String name;
        private String address;
    }

    @Builder
    @Data
    public static class OrderDetail {
        private String orderSn;
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime generateTime;
        private OrderStatus orderStatus;
        private BigDecimal payAmount;
        private BigDecimal supplyPrice;
        private String payType;
        @ApiModelProperty("售后状态")
        private Integer afterSaleStatus;
        @ApiModelProperty("备注")
        private String remark;
        @ApiModelProperty("提交时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;
        @ApiModelProperty("支付时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date payTime;
        @ApiModelProperty("剩余支付时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime endTime;
        @ApiModelProperty("完成时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;

    }

    @Builder
    @Data
    public static class GoodsInfo {
        private Long goodsId;
        private String goodsName;
        private String picUrl;
        private String category;
        private String topCategory;
        private String supplierName;
        private String supplierPhone;
        private String storePhone;
        private String storeName;
        private String chainName;
        private OrderType orderType;
        private Integer goodsNum;
        @ApiModelProperty("商品价格")
        private BigDecimal price;
        @ApiModelProperty("优惠金额")
        private BigDecimal couponPrice;
        @ApiModelProperty("折扣金额")
        private BigDecimal memberPrice;
        @ApiModelProperty("实付金额")
        private BigDecimal actualPrice;
        @ApiModelProperty("支付积分")
        private BigDecimal deductPrice;
        @ApiModelProperty("商品规格")
        private String attribute;
        @ApiModelProperty("货款")
        private BigDecimal supplyPrice;
        @ApiModelProperty("发货时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date shipTime;
        @ApiModelProperty("确认时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime confirmTime;

        private Integer store;
        private Integer chain;
        private Integer supplier;
        //商家id
        private Long id;
    }

    @Data
    @Builder
    public static class UserInfo {
        private Long uuid;
        private String userPhone;
        private String address;
        //收件人
        private String consignee;
        //收件人手机号
        private String consigneePhone;
        //昵称
        private String nickName;
        //备注
        private  String remarks;
        //订单编号
        private String orderGoodsSn;
    }

    @Data
    @Builder
    public static class AfterSaleInfo {
        private Long uuid;
        private String userPhone;
        private BigDecimal refundAmount;
        private String describe;
        private List<String> images;
        @ApiModelProperty("申请时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;
        @ApiModelProperty("结束时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime endTime;
        @ApiModelProperty("售后类型")
        private Integer type;
    }
}
